<template>
	<view class="all">
		<view class="theblock">
			<view class="thetitle">
				订单号:
			</view>
			<view class="thedata">
				{{orderDetail.agentOrderId}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				同程订单号:
			</view>
			<view class="thedata">
				{{orderDetail.alitripOrderId}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				订单状态:
			</view>
			<view class="thedata">
				{{orderDetail.status}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				出发城市:
			</view>
			<view class="thedata">
				{{orderDetail.fromCityName}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				出发站点:
			</view>
			<view class="thedata">
				{{orderDetail.fromStationName}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				到达城市:
			</view>
			<view class="thedata">
				{{orderDetail.toCityName}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				到达站点:
			</view>
			<view class="thedata">
				{{orderDetail.toStationName}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				下单时间:
			</view>
			<view class="thedata">
				{{orderDetail.agentCreateTime}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				出发时间:
			</view>
			<view class="thedata">
				{{orderDetail.departTime}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				下单金额:
			</view>
			<view class="thedata">
				{{orderDetail.firstPrice}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				实际金额:
			</view>
			<view class="thedata">
				{{orderDetail.orderPrice}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				退票费:
			</view>
			<view class="thedata">
				{{orderDetail.refundPrice}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				总票数:
			</view>
			<view class="thedata">
				{{orderDetail.ticketCount}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				出行人数:
			</view>
			<view class="thedata">
				{{orderDetail.successCount}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				联系人:
			</view>
			<view class="thedata">
				{{orderDetail.contactName}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				联系电话:
			</view>
			<view class="thedata">
				{{orderDetail.contactMobile}}
			</view>
		</view>
		<view class="theblock">
			<view class="thetitle">
				乘客信息:
			</view>
			<view class="thedata">
				<div v-for="(iteam,index) in passengerList">
					<FormItem>
						<div style="display: flex;flex-direction: row;">
							<div prop="passengerName" style="padding-right: 10px">
								{{passengerList[index].passengerName}}
							</div>
							<div prop="contactCertificateType" style="padding-right: 10px" v-if="passengerList[index].passengerCertificateType==1">
								身份证
							</div>
							<div prop="contactCertificateType" style="padding-right: 10px" v-if="passengerList[index].passengerCertificateType==2">
								护照
							</div>
							<div prop="contactCertificateType" style="padding-right: 10px" v-if="passengerList[index].passengerCertificateType==3">
								港澳通行证
							</div>
							<div prop="contactCertificateType" style="padding-right: 10px" v-if="passengerList[index].passengerCertificateType==4">
								台湾通行证
							</div>
							<div prop="contactCertificateNo" style="padding-right: 10px">
								{{passengerList[index].passengerCertificateNo}}
							</div>
							<div v-show="passengerList[index].status==0" style="line-height: 32px;padding: 4px 0;">
								<div style="color:#ffffff;background-color: #999999;height: 24px;line-height: 24px;border-radius: 4px;padding: 0 4px;">
									已退票
								</div>
							</div>
						</div>
					</FormItem>
				</div>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				agentOrderId: '',
				alitripOrderId: '',
				contactName: '',
				contactMobile: '',
				startAgentCreatTime: '', // 起始创建日期
				toAgentCreateTime: '', // 终止创建日期
				startFromDate: '', // 起始出发日期
				toFromDate: '', // 终止出发日期
				fromCityName: '', // 起始城市名
				fromStationName: '', // 起始站点名
				toStationName: '', // 到达站点名
				toCityName: '',
				total: 0,
				orderData: {}, // 一条订单数据
				orderId: '', // 订单ID
				orderDetail: {}, // 订单详情
			}
		},
		onLoad(e) {
			this.orderId = e.id;
			this.init();
		},
		methods: {
			init() {
				let self = this;
				let data = {
					orderId: self.orderId
				}
				uni.request({
					url: this.websiteUrl + "/api/order/findByOrderId",
					method: "POST",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: data,
					success: (res) => {
						if (res.data.success) {
							self.orderDetail = res.data.obj;
							if (self.orderDetail.status == 1) {
								self.orderDetail.status = '等待付款';
							}
							if (self.orderDetail.status == 2) {
								self.orderDetail.status = '等待出票';
							}
							if (self.orderDetail.status == 3) {
								self.orderDetail.status = '出票成功';
							}
							if (self.orderDetail.status == 4) {
								self.orderDetail.status = '订单关闭';
							}
							if (self.orderDetail.status == 5) {
								self.orderDetail.status = '订单取消';
							}
							if (self.orderDetail.status == 9) {
								self.orderDetail.status = '订单退票';
							}
							if (self.orderDetail.refundPrice == null) {
								self.orderDetail.refundPrice = 0;
							}
							uni.stopPullDownRefresh(); //关掉刷新图标
							uni.hideLoading(); //隐藏加载图标
							this.showNum = true; //显示搜索条数
						} else {
							uni.hideLoading();
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							});
						}
					}
				});
			}
		},
	}
</script>

<style lang="less">
	.all {
		background-color: #ffffff;
		height: 100%;
		padding: 20upx 30upx;

		.theblock {
			font-size: 30upx;
			line-height: 60upx;
			display: flex;
			flex-direction: row;
			justify-content: space-between;

			.thetitle {
				color: #999999;
				width: 200upx;
			}

			.thedata {
				color: #333333;
			}
		}
	}
</style>
